import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * Created with Intellij IDEA.
 * Description:
 * User:Lenovo
 * Date:2024-12-08
 * Time:11:43
 */
public class Text {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        int left = 0;
        int right = arr.length-1;
        while(left<right){
            while(arr[left]%2!=0&&left<right){
                left++;
            }
            while(arr[right]%2==0&&left<right){
                right--;
            }
            int tmp = arr[left];
            arr[left] = arr[right];
            arr[right] = tmp;
        }
        System.out.println(Arrays.toString(arr));
    }
}
